package com.bzchao.poi;

import lombok.SneakyThrows;
import org.apache.poi.poifs.filesystem.DirectoryEntry;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

import java.io.InputStream;
import java.io.OutputStream;

public class WordHtmlUtil {
    /**
     * 不支持多个class样式(支持层级)
     */
    @SneakyThrows
    private void htmlToWord(InputStream inputStream, OutputStream outputStream) {
        POIFSFileSystem poifsFileSystem = new POIFSFileSystem();
        DirectoryEntry directory = poifsFileSystem.getRoot();
        directory.createDocument("WordDocument", inputStream);
        poifsFileSystem.writeFilesystem(outputStream);
        outputStream.close();
    }
}
